<template>
	<div class="fabu">
		<el-form ref="form" :model="form" label-width="60px">
			<el-form-item label="名字">
				<el-input v-model="form.name"></el-input>
			</el-form-item>
			<el-form-item label="日期">
				<el-input v-model="form.time"></el-input>
			</el-form-item>
			<el-form-item label="吃什么">
				<el-input v-model="form.food"></el-input>
			</el-form-item>
			<el-form-item label="风俗">
				<el-input type="textarea" v-model="form.desc"></el-input>
			</el-form-item>
			<el-form-item>
				<el-button type="primary" @click="iftest">发布</el-button>
			</el-form-item>
		</el-form>

	</div>
</template>


<script>
	import axios from 'axios';
	export default {
		data() {
			return {
				form: {
					name: "",
					time: "",
					food: "",
					desc: ""
				},
				num: 0
			}
		},
		methods: {
			iftest: function() {
				var params = new URLSearchParams();
				params.append('name', this.form.name);
				params.append('time', this.form.time);
				params.append('food', this.form.food);
				params.append('desc', this.form.desc);
				
				axios.post('http://china-orange.cn/admin/article2.php', params)
					.then(response => {
						console.log(response);
					})
					.catch(error => {
						console.log(error);
						alert('网络错误，不能访问');
					})
			}
		},
		created() {

		}
	}
</script>

<style scoped="scoped">
	.fabu {
		padding: 20px;
	}
</style>
